//
//  YCMoreCell.m
//  LOLBox
//
//  Created by mac on 15-4-1.
//  Copyright (c) 2015年 Honey. All rights reserved.
//

#import "YCMoreCell.h"
#import "YCMoreModel.h"

@interface YCMoreCell ()
@property (weak, nonatomic) IBOutlet UIButton *Btn;
@property (weak, nonatomic) IBOutlet UILabel *title;
@property (weak, nonatomic) IBOutlet UILabel *detail;
@property (weak, nonatomic) IBOutlet UIImageView *icon;


@end

@implementation YCMoreCell

- (void)awakeFromNib
{
    // Initialization code
    
}

- (void)fillCellWithModel:(YCMoreModel *)m withValue:(NSInteger)value withIndexPath:(NSIndexPath *)indexPath
{
    
    if (value == 0)
    {
        [self.Btn setBackgroundImage:[UIImage imageNamed:@"bg_cell_top"] forState:UIControlStateNormal];
        [self.Btn setBackgroundImage:[UIImage imageNamed:@"bg_cell_top_h"] forState:UIControlStateHighlighted];
    }
    else if (value == 1)
    {
        [self.Btn setBackgroundImage:[UIImage imageNamed:@"bg_cell_normal"] forState:UIControlStateNormal];
        [self.Btn setBackgroundImage:[UIImage imageNamed:@"bg_cell_normal_h"] forState:UIControlStateHighlighted];
    }
    else if (value == 2)
    {
        [self.Btn setBackgroundImage:[UIImage imageNamed:@"bg_cell_bottom"] forState:UIControlStateNormal];
        [self.Btn setBackgroundImage:[UIImage imageNamed:@"bg_cell_bottom_h"] forState:UIControlStateHighlighted];
    }

    if (indexPath.section == 1 && indexPath.row == 2)
    {
        [self.Btn setTitleColor:[UIColor orangeColor] forState:UIControlStateNormal];
    }
    else
    {
        [self.Btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    }
    //self.Btn.titleLabel.text = m.title;
    [self.Btn setTitle:m.title forState:UIControlStateNormal];
    //[self.Btn setTitle:m.title forState:UIControlStateDisabled];
    //[self.Btn setTitle:m.title forState:UIControlStateHighlighted];
    
    if (![m.detail isKindOfClass:[NSNull class]])
    {
        self.detail.text = m.detail;
    }
    
    if (m.icon.length > 0)
    {
        self.icon.image = [UIImage imageNamed:m.icon];
        self.Btn.titleEdgeInsets = UIEdgeInsetsMake(0, 40, 0, 0);
    }
    else
    {
        self.icon.image = nil;
        self.Btn.titleEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0);
    }
    
}

- (IBAction)onClick:(UIButton *)sender {
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
